1. Field of the Invention
The present invention relates generally to polygon rendering in graphics systems, and more particularly to a system and method of rendering polygons such as triangles using a setup device for reducing the number of time-consuming mathematical operations.
2. Description of Background Art
Graphics systems for computer-generated display of three-dimensional images typically render such images by breaking down on-screen objects into primitives, and rendering each primitive. Primitives may be defined according to their positions, shapes, and other characteristics in three-dimensional space, and are projected onto a two-dimensional surface represented in a frame buffer fir display on a two-dimensional screen. Rendering is typically accomplished using scan conversion or other conventional technique for determining which pixels lie inside the projected primitive. Texture-mapping may be employed to improve the appearance and apparent realism of the resultant projection. These projection and mapping techniques are disclosed, for example, in Foley, van Dam, et al., Computer Graphics: Principles and Practice, 2d ed., Addison-Wesley, 1990, at pp. 67-144 and 741-45.
Primitives often take the form of polygons such as triangles. Accordingly, the overall performance of a graphics system is affected by the speed at which such polygons can be rendered. Conventional systems perform a number of arithmetic operations when rendering each polygon. Given a set of polygon vertex points and material values (such as color, luminosity and the like) for each vertex point, the graphics system determines material values for each pixel in the polygon, as follows.
Preprocessing is performed to determine which pixels lie within the polygon edges defined by the polygon vertices. Material values for pixels within the polygon are then interpolated based on supplied material values for each polygon vertex. Conventionally, such interpolation is performed by determining the slopes of the polygon edges defined by the vertex, and further determining gradients for material values along the polygon edges. See Foley, van Dam, et al. at pp. 735-41 and 668-72. Given the slope of each edge, and the material values of the two vertices corresponding to the edge, interpolated values at the intersection of the edge and any arbitrary scan line can be derived.
Conventional systems determine a slope for each polygon edge, in order to determine the interpolated values to be used in traversing the polygon edges. These values are employed to define starting and ending points of each row in the polygon. Thus, for example, in a system employing triangles as primitives, three slopes are determined for each primitive to be rendered, in order to define the starting and ending points of each row along all three edges of the triangle. Each slope calculation requires a division operation.
One additional division operation is needed, as follows material properties, such as alpha, color, texture, and perspective values, are iterated over a triangle using bilinear interpolation, as defined by a linear equation of the form: EQU q(x,y)=A.sub.q x+B.sub.q y+C.sub.q (Eq. 1)
where q is any material property, and A, B, and C are constants.
If this equation is expanded for all three vertices of a triangle, and the equations are solved for A.sub.q, B.sub.q, and C.sub.q, it becomes clear that the denominator of the fraction of the values of A.sub.q and B.sub.q is equal to twice the area of the triangle. Thus, an additional division operation is required for determination of the inverse of polygon area.
Thus, for systems employing triangles, four division operations are required for each polygon rendering operation. In general, division calculation is a time-consuming operation. Hence, the four division operations required for triangle rendering represent a significant bottleneck in throughput for conventional graphics systems.
In conventional graphics systems, slopes are provided for each of the three edges of a triangle. Using this information, starting and ending points of each span are determined. Material properties are then interpolated along the span in order to develop values for each pixel in the span. Such techniques are described, for example, in Foley, van Dam, et al. at pp. 883-85.
Thus, it can be seen that conventional graphics systems employ techniques that involve a number of time-consuming division operations. Using a geometric processor to calculate slopes and gradients for a polygon can be an expensive solution requiring additional components, while relying on the central processing unit to perform such operations can result in diminished performance.
What is needed is a system for rendering polygons that reduces the number of expensive division operations required for each polygon, so as to improve overall performance without increasing system cost or introducing additional component architecture.